/*
 * Copyright (c) 2017. danlu.com Co.Ltd. All rights reserved.
 */

package cn.com.dhc.danlu.activity.delivery.order.view;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import cn.com.dhc.danlu.R;
import cn.com.dhc.danlu.widget.base.BaseFullScreenPopupView;
import cn.com.hd.mall.web.webservices.entity.response.order.OrderChangeNote;

/**
 * author: wuhaiyang(<a href="mailto:wuhaiyang@danlu.com">wuhaiyang@danlu.com</a>)<br/>
 * version: 1.0.0<br/>
 * since: 2017-03-13 上午11:49<br/>
 * <p>
 *     用户查看改价备注
 * </p>
 */
public class FullScreenPriceChangeNotePopview extends BaseFullScreenPopupView {

    private TextView tvNoteTime;

    private TextView tvNoteContent;

    public FullScreenPriceChangeNotePopview(Context context) {
        super(context);

        initView(context);
    }

    public void refreshView(OrderChangeNote note) {
        OrderChangeNote.OrderChangePriceCommentInfoBean commentInfo = note.getOrderChangePriceCommentInfo();
        String dealDate = commentInfo.getDealDate();
        if (!TextUtils.isEmpty(dealDate)) {
            tvNoteTime.setText(dealDate);
        }
        String comments = commentInfo.getComments();
        if (!TextUtils.isEmpty(comments)) {
            tvNoteContent.setText("\u3000\u3000" + comments);
        }
    }

    private void initView(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.popup_price_change_note, null);

        tvNoteTime = (TextView) view.findViewById(R.id.tv_note_time);

        tvNoteContent = (TextView) view.findViewById(R.id.tv_note_content);

        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

        setContentView(view);
    }

}
